#ifndef PORTMANAGE_H
#define PORTMANAGE_H

#pragma once

#include <QObject>
#include <QSerialPort>
#include <QMap>
#include <QQueue>

namespace ns_yht
{

    class PortManage : public QObject
    {
        Q_OBJECT
    public:
        PortManage(QObject *parent = nullptr);
        ~PortManage();

        virtual QString getPortsSetting() const = 0;
        virtual void setPortsSetting(const QString &portsSetting) = 0;

        virtual void moveToThreadEx(QThread *thread);

    protected:
        void timerEvent(QTimerEvent *event) override;
        QByteArray m_buffer;
        QQueue<QByteArray> m_msgQueue;
        int m_timerId{0};
        int m_runtimes{0};
    };

}

#endif